import type { App } from "vue";
import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";

export const Layout = () => import("@/layout/index.vue");

// 静态路由
export const constantRoutes: RouteRecordRaw[] = [
  {
    path: "/redirect",
    component: Layout,
    meta: { hidden: true },
    children: [
      {
        path: "/redirect/:path(.*)",
        component: () => import("@/views/redirect/index.vue"),
      },
    ],
  },

  {
    path: "/login",
    component: () => import("@/views/login/index.vue"),
    meta: { hidden: true },
  },

  {
    path: "/",
    name: "/",
    component: Layout,
    redirect: "/dashboard",
    children: [
      {
        path: "dashboard",
        component: () => import("@/views/dashboard/index.vue"),
        // 用于 keep-alive 功能，需要与 SFC 中自动推导或显式声明的组件名称一致
        // 参考文档: https://cn.vuejs.org/guide/built-ins/keep-alive.html#include-exclude
        name: "Dashboard",
        meta: {
          title: "dashboard",
          icon: "homepage",
          affix: true,
          keepAlive: true,
        },
      },
      {
        path: "401",
        component: () => import("@/views/error-page/401.vue"),
        meta: { hidden: true },
      },
      {
        path: "404",
        component: () => import("@/views/error-page/404.vue"),
        meta: { hidden: true },
      },
    ],
  },
  // {
  //   path: "/",
  //   name: "/",
  //   component: Layout,
  //   redirect: "/dashboard",
  //    children: [
  //     {
  //       path: "index",
  //       component: () => import("@/views/dashboard/index.vue"),
  //       // 用于 keep-alive 功能，需要与 SFC 中自动推导或显式声明的组件名称一致
  //       // 参考文档: https://cn.vuejs.org/guide/built-ins/keep-alive.html#include-exclude
  //       name: "index",
  //       meta: {
  //         title: "dashboard",
  //         icon: "homepage",
  //         affix: true,
  //         keepAlive: true,
  //       },
  //     },
  //   ],
  // }
  // 外部链接
  // {
  //   path: "/external-link",
  //   component: Layout,
  //   children: [ {
  //       component: () => import("@/views/external-link/index.vue"),
  //       path: "https://www.cnblogs.com/haoxianrui/",
  //       meta: { title: "外部链接", icon: "link" },
  //     },
  //   ],
  // },
  // 多级嵌套路由
  /* {
         path: '/nested',
         component: Layout,
         redirect: '/nested/level1/level2',
         name: 'Nested',
         meta: {title: '多级菜单', icon: 'nested'},
         children: [
             {
                 path: 'level1',
                 component: () => import('@/views/nested/level1/index.vue'),
                 name: 'Level1',
                 meta: {title: '菜单一级'},
                 redirect: '/nested/level1/level2',
                 children: [
                     {
                         path: 'level2',
                         component: () => import('@/views/nested/level1/level2/index.vue'),
                         name: 'Level2',
                         meta: {title: '菜单二级'},
                         redirect: '/nested/level1/level2/level3',
                         children: [
                             {
                                 path: 'level3-1',
                                 component: () => import('@/views/nested/level1/level2/level3/index1.vue'),
                                 name: 'Level3-1',
                                 meta: {title: '菜单三级-1'}
                             },
                             {
                                 path: 'level3-2',
                                 component: () => import('@/views/nested/level1/level2/level3/index2.vue'),
                                 name: 'Level3-2',
                                 meta: {title: '菜单三级-2'}
                             }
                         ]
                     }
                 ]
             },
         ]
     }*/
  //多级嵌套路由
  // {
  //   path: "/system",
  //   name: "/system",
  //   redirect: "/system/user",
  //   meta: {
  //     title: "系统管理",
  //     icon: "ip",
  //     hidden: false,
  //     roles: ["ADMIN"],
  //   },
  //   component: Layout,
  //   children: [
  //     {
  //       name: "user",
  //       component: () => import("@/views/system/user/index.vue"),
  //       path: "user",
  //       meta: {
  //         title: "用户管理",
  //         icon: "user",
  //         hidden: false,
  //         keepAlive: true,
  //         roles: ["ADMIN"],
  //       },
  //     },
  //     {
  //       name: "role",
  //       component: () => import("@/views/system/role/index.vue"),
  //       path: "role",
  //       meta: {
  //         title: "角色管理",
  //         icon: "role",
  //         hidden: false,
  //         keepAlive: true,
  //         roles: ["ADMIN"],
  //       },
  //     },
  //     {
  //       name: "menu",
  //       component: () => import("@/views/system/menu/index.vue"),
  //       path: "menu",
  //       meta: {
  //         title: "菜单管理",
  //         icon: "menu",
  //         hidden: false,
  //         keepAlive: true,
  //         roles: ["ADMIN"],
  //       },
  //     },
  //     {
  //       name: "dept",
  //       component: () => import("@/views/system/dept/index.vue"),
  //       path: "dept",
  //       meta: {
  //         title: "部门管理",
  //         icon: "tree",
  //         hidden: false,
  //         keepAlive: true,
  //         roles: ["ADMIN"],
  //       },
  //     },
  //     {
  //       name: "dic",
  //       component: () => import("@/views/system/dict/index.vue"),
  //       path: "dict",
  //       meta: {
  //         title: "字典管理",
  //         icon: "dict",
  //         hidden: false,
  //         keepAlive: true,
  //         roles: ["ADMIN"],
  //       },
  //     },
  //   ],
  // },
  //权限管理
  {
    path: "/PersonnelManagement",
    name: "PersonnelManagement",
    redirect: "/PersonnelManagement/PersonnelManagement",
    meta: {
      title: "权限管理",
      Icon: "system",
      hidden: false,
      roles: ["ADMIN"],
    },
    component: Layout,
    children: [
      {
        name: "PersonnelManagement",
        path: "/PersonnelManagement",
        meta: {
          title: "人员管理",
          icon: "user",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
        children: [
          {
            name: "IncreaseStaffing",
            component: () =>
              import(
                "../views/PermissionsManagement/PersonnelManagement/IncreaseStaffing.vue"
              ),
            path: "IncreaseStaffing",
            meta: {
              title: "增加人员",
              icon: "user",
              hidden: false,
              keepAlive: true,
              roles: ["ADMIN"],
            },
          },
          // {
          //   name: "ViewPeople",
          //   component: () =>
          //     import(
          //       "../views/PermissionsManagement/PersonnelManagement/ViewPeople.vue"
          //     ),
          //   path: "ViewPeople",
          //   meta: {
          //     title: "查看人员",
          //     icon: "user",
          //     hidden: false,
          //     keepAlive: true,
          //     roles: ["ADMIN"],
          //   },
          // },
        ],
      },
      {
        name: "CharacterSettings",
        component: () =>
          import("../views/PermissionsManagement/CharacterSettings.vue"),
        path: "CharacterSettings",
        meta: {
          title: "角色设置",
          icon: "user",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "PermissionAssignment",
        component: () =>
          import("../views/PermissionsManagement/PermissionAssignment.vue"),
        path: "PermissionAssignment",
        meta: {
          title: "权限分配",
          icon: "user",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
    ],
  },
  //生产管理
  {
    path: "/Production",
    name: "/Production",
    redirect: "/Production/SheepFile",
    meta: {
      title: "生产管理",
      icon: "tree",
      hidden: false,
      roles: ["ADMIN"],
    },
    component: Layout,
    children: [
      {
        name: "SheepFile",
        component: () =>
          import("../views/Production/SheepFiles/SheepFileView.vue"),
        path: "/SheepFile",
        meta: {
          title: "羊只档案 ",
          icon: "document",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "SheepFileInfo",
        component: () => import("../views/Production/SheepFiles/Info.vue"),
        path: "/SheepFileInfo",
        meta: {
          title: "羊只详情",
          icon: "el-icon-Postcard",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "SheepRescission",
        component: () =>
          import("../views/Production/SheepRescissions/index.vue"),
        path: "/SheepRescission",
        meta: {
          title: "羊只转舍 ",
          icon: "el-icon-house",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "SheepRescissionAdd",
        component: () => import("../views/Production/SheepRescissions/SheepRescissionAdd.vue"),
        path: "/SheepRescissionAdd",
        meta: {
          title: "羊只转舍-新增",
          icon: "dict ",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "SheepFileMAdd",
        component: () =>
          import("../views/Production/SheepFiles/SheepFileMAdd.vue"),
        path: "/SheepFileMAdd",
        meta: {
          title: "种母新增 ",
          icon: "edit ",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "SheepFileFAdd",
        component: () =>
          import("../views/Production/SheepFiles/SheepFileFAdd.vue"),
        path: "/SheepFileFAdd",
        meta: {
          title: "种公新增 ",
          icon: "edit ",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "SheepFileHAdd",
        component: () =>
          import("../views/Production/SheepFiles/SheepFileHAdd.vue"),
        path: "/SheepFileHAdd",
        meta: {
          title: "后裔新增 ",
          icon: "edit ",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "SheepFileEdit",
        component: () =>
          import("../views/Production/SheepFiles/SheepFileEdit.vue"),
        path: "/SheepFileEdit/:sheepFileId",
        meta: {
          title: "档案修改 ",
          icon: "edit ",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "HyBridization",
        component: () =>
          import("../views/Production/HyBridization/ShowHyBridization.vue"),
        path: "/HyBridization",
        meta: {
          title: "种母配种列表 ",
          icon: "el-icon-film",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "AddHyBridization",
        component: () =>
          import("../views/Production/HyBridization/AddHyBridization.vue"),
        path: "/AddHyBridization",
        meta: {
          title: "新增种母配种 ",
          icon: "el-icon-film",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "PregnancyCheck",
        component: () =>
          import("../views/Production/PregnancyCheck/ShowPregnancyCheck.vue"),
        path: "/PregnancyCheck",
        meta: {
          title: "种母妊检列表 ",
          icon: "el-icon-toilet-paper",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "AddPregnancyCheck",
        component: () =>
          import("../views/Production/PregnancyCheck/AddPregnancyCheck.vue"),
        path: "/AddPregnancyCheck",
        meta: {
          title: "新增种母妊检 ",
          icon: "el-icon-toilet-paper",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "Delivery",
        component: () =>
          import("../views/Production/Delivery/ShowDelivery.vue"),
        path: "/Delivery",
        meta: {
          title: "种母分娩列表 ",
          icon: "el-icon-school",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "AddDelivery",
        component: () => import("../views/Production/Delivery/AddDelivery.vue"),
        path: "/AddDelivery",
        meta: {
          title: "新增种母分娩 ",
          icon: "el-icon-school",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "EweWeaning",
        component: () =>
          import("../views/Production/EweWeaning/ShowEweWeaning.vue"),
        path: "/EweWeaning",
        meta: {
          title: "种母断奶列表 ",
          icon: "el-icon-goblet-square-full",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "AddEweWeaning",
        component: () =>
          import("../views/Production/EweWeaning/AddEweWeaning.vue"),
        path: "/AddEweWeaning",
        meta: {
          title: "新增种母断奶",
          icon: "el-icon-goblet-square-full",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "History",
        component: () => import("../views/Production/History/ShowHistory.vue"),
        path: "/History",
        meta: {
          title: "种母历史记录 ",
          icon: "el-icon-film",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "AddHistory",
        component: () => import("../views/Production/History/AddHistory.vue"),
        path: "/AddHistory",
        meta: {
          title: "新增种母历史记录",
          icon: "el-icon-film",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "ProgenyTransferAdd",
        component: () =>
          import("../views/Production/ProgenyTransfer/ProgenyTransferAdd.vue"),
        path: "/ProgenyTransferAdd",
        meta: {
          title: "后裔转种-新增 ",
          icon: "el-icon-toilet-paper",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "ProgenyTransferShow",
        component: () =>
          import("../views/Production/ProgenyTransfer/ProgenyTransferShow.vue"),
        path: "/ProgenyTransferShow",
        meta: {
          title: "后裔转种 ",
          icon: "el-icon-school",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
       {
        name: "ProgenyTransferUpd",
        component: () =>
          import("../views/Production/ProgenyTransfer/ProgenyTransferUpd.vue"),
        path: "/ProgenyTransferUpd",
        meta: {
          title: "后裔转种修改 ",
          icon: "el-icon-school",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "ShowAblactation",
        component: () => import("../views/Production/Ablactation/index.vue"),
        path: "/ShowAblactation",
        meta: {
          title: "羔羊断奶列表 ",
          icon: "el-icon-list",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "AddAblactation",
        component: () => import("../views/Production/Ablactation/addIndex.vue"),
        path: "/AddAblactation",
        meta: {
          title: "新增羔羊断奶",
          icon: "el-icon-list",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "updIndex",
        component: () => import("../views/Production/Ablactation/updIndex.vue"),
        path: "/updIndex",
        meta: {
          title: "修改羔羊断奶",
          icon: "el-icon-list",
          hidden: true,
          keepAlive: false,
          roles: ["ADMIN"],
        },
      },
    ],
  },
  //期初管理
  {
    path: "/BeginningManagement",
    name: "/BeginningManagement",
    redirect: "/BeginningManagement/EarlyStageOfBreedingShow",
    meta: {
      title: "期初管理",
      icon: "el-icon-star",
      hidden: false,
      roles: ["ADMIN"],
    },
    component: Layout,
    children: [
      {
        name: "EarlyStageOfBreeding",
        path: "/EarlyStageOfBreedingShow",
        component: () =>
          import(
            "@/views/BeginningManagement/EarlyStageOfBreeding/EarlyStageOfBreedingShow.vue"
          ),
        meta: {
          title: "种公期初 ",
          icon: "el-icon-cloudy",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "EarlyStageOfBreedingADD",
        path: "/EarlyStageOfBreedingADD",
        component: () =>
          import(
            "@/views/BeginningManagement/EarlyStageOfBreeding/EarlyStageOfBreedingADD.vue"
          ),
        meta: {
          title: "种公期初-新增 ",
          icon: "el-icon-partly-cloudy",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "EarlyBreedingHenShow",
        path: "/EarlyBreedingHenShow",
        component: () =>
          import(
            "@/views/BeginningManagement/EarlyBreedingHen/EarlyBreedingHenShow.vue"
          ),
        meta: {
          title: "种母期初 ",
          icon: "el-icon-partly-cloudy",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "EarlyBreedingHen",
        path: "/EarlyBreedingHenADD",
        component: () =>
          import(
            "@/views/BeginningManagement/EarlyBreedingHen/EarlyBreedingHenADD.vue"
          ),
        meta: {
          title: "种母期初-新增",
          icon: "homepage",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "/EarlyDescent",
        path: "/EarlyDescent",
        component: () =>
          import(
            "@/views/BeginningManagement/EarlyDescent/EarlyDescentShow.vue"
          ),
        meta: {
          title: "后裔期初 ",
          icon: "el-icon-sunrise",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "EarlyDescentADD",
        path: "/EarlyDescentADD",
        component: () =>
          import(
            "@/views/BeginningManagement/EarlyDescent/EarlyDescentADD.vue"
          ),
        meta: {
          title: "后裔期初-新增",
          icon: "homepage",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
    ],
  },
  //羊只管理
  {
    path: "/Sheepmanagement",
    name: "/Sheepmanagement",
    redirect: "/Sheepmanagement/SheepDie",
    meta: {
      title: "羊只管理",
      Icon: "SheepDie",
      hidden: false,
      roles: ["ADMIN"],
    },
    component: Layout,
    children: [
      {
        path: "/Sheepmanagement/SheepDie",
        name: "/Sheepmanagement/SheepDie",
        component: () => import("@/views/Sheepmanagement/SheepDie.vue"),
        meta: {
          title: "羊只死亡",
          icon: "SheepDie",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        path: "/Sheepmanagement/SheepElimin",
        name: "/Sheepmanagement/SheepElimin",
        component: () => import("@/views/Sheepmanagement/SheepElimin.vue"),
        meta: {
          title: "羊只淘汰",
          icon: "SheepElimin",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },

      {
        name: "SheepList.vue",
        component: () => import("@/views/Sheepmanagement/SheepList.vue"),
        path: "/SheepList.vue",
        meta: {
          title: "死亡管理",
          icon: "el-icon-circlePlusFilled",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "SheepUpdate.vue",
        component: () => import("@/views/Sheepmanagement/SheepUpdate.vue"),
        path: "/SheepUpdate",
        meta: {
          title: "耳标修改",
          icon: "el-icon-circlePlusFilled",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
    ],
  },
  // 采购销售
  {
    path: "/PurchaseSales",
    name: "/PurchaseSales",
    redirect: "/supplier/index",
    meta: {
      title: "采购销售",
      icon: "el-icon-Van",
      hidden: false,
      roles: ["ADMIN"],
    },
    component: Layout,
    children: [
      {
        path: "/supplier/index",
        name: "/supplier/index",
        component: () => import("../views/PurchaseSales/supplier/index.vue"),
        meta: {
          title: "供应商管理",
          icon: "document",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        path: "/editSupplier",
        name: "/editSupplier",
        component: () =>
          import("@/views/PurchaseSales/supplier/editSupplier.vue"),
        meta: {
          title: "供应商查看",
          icon: "/editSupplier",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        path: "/updateSupplier",
        name: "/updateSupplier",
        component: () =>
          import("../views/PurchaseSales/supplier/updateSupplier.vue"), //../ views / purchaseSales / supplier / index.vue
        meta: {
          title: "供应商修改",
          icon: "index",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        path: "/addSupplier",
        name: "/addSupplier",
        component: () =>
          import("../views/PurchaseSales/supplier/addSupplier.vue"), //../ views / purchaseSales / supplier / index.vue
        meta: {
          title: "添加",
          icon: "index",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        path: "/mapIndex",
        name: "/mapIndex",
        component: () => import("../views/PurchaseSales/supplier/mapIndex.vue"), //../ views / purchaseSales / supplier / index.vue
        meta: {
          title: "供应商地图",
          icon: "index",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        path: "/dialog",
        name: "/dialog",
        component: () => import("../views/PurchaseSales/supplier/dialog.vue"), //../ views / purchaseSales / supplier / index.vue
        meta: {
          title: "供应商地图1",
          icon: "index",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        path: "/IndividualSales",
        name: "/IndividualSales",
        component: () =>
          import("../views/PurchaseSales/IndividualSales/SheepAreSoldList.vue"), //../ views / purchaseSales / supplier / index.vue
        meta: {
          title: "个体销售",
          icon: "document",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        path: "/SheepAreSoldADD",
        name: "/SheepAreSoldADD",
        component: () =>
          import("../views/PurchaseSales/IndividualSales/SheepAreSoldADD.vue"), //../ views / purchaseSales / supplier / index.vue
        meta: {
          title: "个体销售添加",
          icon: "document",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        path: "/SheepAreSoldDetail",
        name: "/SheepAreSoldDetail",
        component: () =>
          import(
            "../views/PurchaseSales/IndividualSales/SheepAreSoldDetail.vue"
          ), //../ views / purchaseSales / supplier / index.vue
        meta: {
          title: "个体销售详情",
          icon: "document",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        path: "/CustomerADD",
        name: "/CustomerADD",
        component: () =>
          import("../views/PurchaseSales/CustomerManagement/CustomerADD.vue"), //../ views / purchaseSales / supplier / index.vue
        meta: {
          title: "客户添加",
          icon: "document",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        path: "/CustomerManagement",
        name: "/CustomerManagement",
        component: () =>
          import("../views/PurchaseSales/CustomerManagement/CustomerLIST.vue"), //../ views / purchaseSales / supplier / index.vue
        meta: {
          title: "客户管理",
          icon: "document",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        path: "/editCustomer",
        name: "/editCustomer",
        component: () =>
          import("../views/PurchaseSales/CustomerManagement/editCustomer.vue"), //../ views / purchaseSales / supplier / index.vue
        meta: {
          title: "客户查看",
          icon: "document",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        path: "/IndividualProcurement",
        name: "IndividualProcurement",
        redirect: "/PurchaseSales/IndividualProcurement",
        meta: {
          title: "个体采购",
          icon: "document",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
        children: [
          {
            name: "SheepProcurementADD",
            component: () =>
              import(
                "../views/PurchaseSales/IndividualProcurement/SheepProcurementADD.vue"
              ),
            path: "/SheepProcurementADD",
            meta: {
              title: "羊只采购",
              icon: "user",
              hidden: false,
              keepAlive: true,
              roles: ["ADMIN"],
            },
          },
          {
            name: "SheepProcurementList",
            component: () =>
              import(
                "../views/PurchaseSales/IndividualProcurement/SheepProcurementList.vue"
              ),
            path: "/SheepProcurementList",
            meta: {
              title: "羊只采购-查看",
              icon: "user",
              hidden: false,
              keepAlive: true,
              roles: ["ADMIN"],
            },
          },
          {
            name: "SheepProcirementUpdate",
            component: () =>
              import(
                "../views/PurchaseSales/IndividualProcurement/SheepProcirementUpdate.vue"
              ),
            path: "/SheepProcirementUpdate",
            meta: {
              title: "羊只采购-修改",
              icon: "user",
              hidden: true,
              keepAlive: true,
              roles: ["ADMIN"],
            },
          },
        ],
      },
    ],
  },
  //组织设置
  {
    path: "/Organizations",
    name: "Organizations",
    redirect: "/Organizations/enterprices",
    meta: {
      title: "组织设置",
      icon: "tree",
      hidden: false,
      roles: ["ADMIN"],
    },
    component: Layout,
    children: [
      {
        name: "/enterprices",
        component: () => import("../views/Organizations/enterprices/index.vue"),
        path: "/enterprices",
        meta: {
          title: "单位设置 ",
          icon: "el-icon-officeBuilding",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "/department",
        component: () => import("../views/Organizations/department/index.vue"),
        path: "/department",
        meta: {
          title: "部门设置-添加",
          icon: "el-icon-house",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "/ShowList",
        component: () =>
          import("../views/Organizations/department/showList.vue"),
        path: "/ShowList",
        meta: {
          title: "部门设置-列表",
          icon: "el-icon-list",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "/sheepindex",
        component: () => import("../views/Organizations/sheepyards/index.vue"),
        path: "/sheepindex",
        meta: {
          title: "羊场设置",
          icon: "el-icon-Setting",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "/ridgepolefieds",
        component: () =>
          import("../views/Organizations/ridgepolefieds/index.vue"),
        path: "/ridgepolefieds",
        meta: {
          title: "栋舍设置",
          icon: "el-icon-Setting",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },

      {
        name: "/ridgepoleAdd",
        component: () =>
          import("../views/Organizations/ridgepolefieds/IndexAdd.vue"),
        path: "/ridgepoleAdd",
        meta: {
          title: "栋舍添加",
          icon: "el-icon-Setting",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "/ridgepoleUpdate",
        component: () =>
          import("../views/Organizations/ridgepolefieds/indexUpdate.vue"),
        path: "/ridgepoleUpdate",
        meta: {
          title: "栋舍修改",
          icon: "el-icon-Setting",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },

      {
        name: "/ColumnListShow",
        component: () =>
          import("../views/Organizations/ridgepolefieds/ColumnList.vue"),
        path: "/ColumnListShow",
        meta: {
          title: "栋舍显示",
          icon: "el-icon-Setting",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "/AddColumnList",
        component: () =>
          import("../views/Organizations/ridgepolefieds/AddColumnList.vue"),
        path: "/AddColumnList",
        meta: {
          title: "栏位添加",
          icon: "el-icon-Setting",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
    ],
  },
  //耳标管理
  {
    path: "/eartags",
    name: "eartags",
    redirect: "/eartags/Earindex",
    meta: {
      title: "耳标设置",
      icon: "el-icon-cloudy",
      hidden: false,
      roles: ["ADMIN"],
    },
    component: Layout,
    children: [
      {
        name: "Earindex",
        component: () => import("../views/eartags/index.vue"),
        path: "/Earindex",
        meta: {
          title: "耳标新增 ",
          icon: "el-icon-circlePlusFilled",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "EarList",
        component: () => import("../views/eartags/listIndex.vue"),
        path: "/EarList",
        meta: {
          title: "耳标列表",
          icon: "el-icon-circlePlusFilled",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "Eleartag",
        component: () => import("../views/eartags/elindex.vue"),
        path: "/Eleartag",
        meta: {
          title: "耳标修改",
          icon: "el-icon-circlePlusFilled",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
    ],
  },
  //育种管理
  {
    path: "/Breeding",
    name: "Breeding",
    redirect: "/Breeding/SpWeight",
    meta: {
      title: "育种管理",
      icon: "el-icon-Tickets",
      hidden: false,
      roles: ["ADMIN"],
    },
    component: Layout,
    children: [
      {
        name: "SpWeight",
        component: () => import("../views/Breeding/SpWeight/SpWeightShow.vue"),
        path: "/SpWeight",
        meta: {
          title: "羊只称重",
          icon: "el-icon-Document",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "SpMeasure",
        component: () =>
          import("../views/Breeding/SpMeasure/SpMeasureShow.vue"),
        path: "/SpMeasure",
        meta: {
          title: "羊只体测",
          icon: "el-icon-DocumentCopy",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "SpAppearance",
        component: () =>
          import("../views/Breeding/SpAppearance/SpAppearanceShow.vue"),
        path: "/SpAppearance",
        meta: {
          title: "羊只品相",
          icon: "el-icon-Reading",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
    ],
  },
  //个人设置
  {
    path: "/PersonalSettings",
    name: "PersonalSettings",
    redirect: "/src/views/PersonalSettings",
    meta: {
      title: "个人设置",
      icon: "el-icon-Avatar",
      hidden: false,
      roles: ["ADMIN"],
    },
    component: Layout,
    children: [
      {
        name: "PersonalInformation",
        component: () =>
          import("@/views/PersonalSettings/PersonalInformation.vue"),
        path: "/PersonalInformation",
        meta: {
          title: "个人信息 ",
          icon: "el-icon-ChatLineSquare",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "SecuritySettings",
        component: () =>
          import("@/views/PersonalSettings/SecuritySettings.vue"),
        path: "/SecuritySettings",
        meta: {
          title: "安全设置 ",
          icon: "el-icon-Setting",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "SecurePasswords",
        component: () => import("@/views/PersonalSettings/SecurePasswords.vue"),
        path: "/SecurePasswords",
        meta: {
          title: "安全密码 ",
          icon: "el-icon-Unlock",
          hidden: true,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
    ],
  },
  //汇总报表
  {
    path: "/CombinationStatement",
    name: "CombinationStatement",
    redirect: "/src/views/CombinationStatement",
    meta: {
      title: "汇总报表",
      icon: "el-icon-Histogram",
      hidden: false,
      roles: ["ADMIN"],
    },
    component: Layout,
    children: [
      {
        name: "SeedProductionStatistics",
        component: () =>
          import(
            "@/views/CombinationStatement/Seedproductionstatistics/index.vue"
          ),
        path: "/SeedProductionStatistics",
        meta: {
          title: "种母生产统计 ",
          icon: "trend-two",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "LiveStock",
        component: () => import("@/views/CombinationStatement/LiveStock.vue"),
        path: "/LiveStock",
        meta: {
          title: "羊场存栏统计 ",
          icon: "trend-two",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
    ],
  },
  //提示报表
  {
    path: "/PromptReport",
    name: "PromptReport",
    redirect: "/src/views/PromptReport",
    meta: {
      title: "提示报表",
      icon: "el-icon-Avatar",
      hidden: false,
      roles: ["ADMIN"],
    },
    component: Layout,
    children: [
      {
        name: "WaitToBeInstalled",
        component: () => import("@/views/PromptReport/WaitToBeInstalled.vue"),
        path: "/WaitToBeInstalled",
        meta: {
          title: "待配提示 ",
          icon: "el-icon-ChatLineSquare",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "PregnancyTestSuggestion",
        component: () =>
          import("@/views/PromptReport/PregnancyTestSuggestion.vue"),
        path: "/PregnancyTestSuggestion",
        meta: {
          title: " 妊检提示 ",
          icon: "el-icon-Setting",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
      {
        name: "ChildbirthHint",
        component: () => import("@/views/PromptReport/ChildbirthHint.vue"),
        path: "/ChildbirthHint",
        meta: {
          title: "分娩提示 ",
          icon: "el-icon-Unlock",
          hidden: false,
          keepAlive: true,
          roles: ["ADMIN"],
        },
      },
    ],
  },
];

/**
 * 创建路由
 */
const router = createRouter({
  history: createWebHashHistory(),
  routes: constantRoutes,
  // 刷新时，滚动条位置还原
  scrollBehavior: () => ({ left: 0, top: 0 }),
});

// 全局注册 router
export function setupRouter(app: App<Element>) {
  app.use(router);
}

/**
 * 重置路由
 */
export function resetRouter() {
  router.replace({ path: "/login" });
}

export default router;
